<?php
class Henry_String_FixviCharacter{
	static function change($string){
		$string = preg_replace("/á|à|ả|ã|ạ|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ/","a", $string);
    	$string = preg_replace("/Á|À|Ả|Ã|Ạ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ/","A", $string);
    	$string = preg_replace("/é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ/","e", $string);
    	$string = preg_replace("/É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ/","E", $string);
    	$string = preg_replace("/í|ì|ỉ|ĩ|ị/","i", $string);
    	$string = preg_replace("/Í|Ì|Ỉ|Ĩ|Ị/","I", $string);
        $string = preg_replace("/ý|ỳ|ỷ|ỹ|ỵ/","y", $string);
        $string = preg_replace("/Ý|Ỳ|Ỷ|Ỹ|Ỵ/","Y", $string);
    	$string = preg_replace("/o|ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ/","o", $string);
    	$string = preg_replace("/O|Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ/","O", $string);
    	$string = preg_replace("/u|ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự/","u", $string);
    	$string = preg_replace("/U|Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự/","U", $string);
    	$string = preg_replace("/đ/","d", $string);
    	$string = preg_replace("/Đ/","D", $string);
    	$string = preg_replace("/[^a-zA-Z0-9\s-]+/","", $string);
    	$string = preg_replace("/\s+/","-", $string);
    	$string = preg_replace("/-+/","-", $string);
    	$string = strtolower($string);
    	return $string;
	}
}